home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** A collection of useful high-level File Manager routines.
- **
- ** by Jim Luther, Apple Developer Technical Support
- **
- ** File: MoreFilesExtras.h
- **
- ** Copyright © 1992-1994 Apple Computer, Inc.
- ** All rights reserved.
- **
- ** You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DSC Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes.
- */
-
- #ifndef __MOREFILESEXTRAS__
- #define __MOREFILESEXTRAS__
-
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __ERRORS__
- #include <Errors.h>
- #endif
-
- #ifndef __MEMORY__
- #include <Memory.h>
- #endif
-
- #ifndef __OSUTILS__
- #include <OSUtils.h>
- #endif
-
- #ifndef __FILES__
- #include <Files.h>
- #endif
-
- #ifndef __FOLDERS__
- #include <Folders.h>
- #endif
-
- #ifndef __MOREFILES__
- #include "MoreFiles.h"
- #endif
-
- /* Sharing.h should be in Files.h, but isn't yet... */
- //#ifndef __SHARING__
- //#include "Sharing.h"
- //#endif
-
-
- /*
- ** Macros to get information out of GetVolParmsInfoBuffer
- */
-
- #define isNetworkVolume(volParms) ((volParms).vMServerAdr != 0)
- #define hasLimitFCBs(volParms) (((volParms).vMAttrib & (1L << bLimitFCBs)) != 0)
- #define hasLocalList(volParms) (((volParms).vMAttrib & (1L << bLocalWList)) != 0)
- #define hasNoMiniFndr(volParms) (((volParms).vMAttrib & (1L << bNoMiniFndr)) != 0)
- #define hasNoVNEdit(volParms) (((volParms).vMAttrib & (1L << bNoVNEdit)) != 0)
- #define hasNoLclSync(volParms) (((volParms).vMAttrib & (1L << bNoLclSync)) != 0)
- #define hasTrshOffLine(volParms) (((volParms).vMAttrib & (1L << bTrshOffLine)) != 0)
- #define hasNoSwitchTo(volParms) (((volParms).vMAttrib & (1L << bNoSwitchTo)) != 0)
- #define hasNoDeskItems(volParms) (((volParms).vMAttrib & (1L << bNoDeskItems)) != 0)
- #define hasNoBootBlks(volParms) (((volParms).vMAttrib & (1L << bNoBootBlks)) != 0)
- #define hasAccessCntl(volParms) (((volParms).vMAttrib & (1L << bAccessCntl)) != 0)
- #define hasNoSysDir(volParms) (((volParms).vMAttrib & (1L << bNoSysDir)) != 0)
- #define hasExtFSVol(volParms) (((volParms).vMAttrib & (1L << bHasExtFSVol)) != 0)
- #define hasOpenDeny(volParms) (((volParms).vMAttrib & (1L << bHasOpenDeny)) != 0)
- #define hasCopyFile(volParms) (((volParms).vMAttrib & (1L << bHasCopyFile)) != 0)
- #define hasMoveRename(volParms) (((volParms).vMAttrib & (1L << bHasMoveRename)) != 0)
- #define hasDesktopMgr(volParms) (((volParms).vMAttrib & (1L << bHasDesktopMgr)) != 0)
- #define hasShortName(volParms) (((volParms).vMAttrib & (1L << bHasShortName)) != 0)
- #define hasFolderLock(volParms) (((volParms).vMAttrib & (1L << bHasFolderLock)) != 0)
- #define hasPersonalAccessPrivileges(volParms) \
- (((volParms).vMAttrib & (1L << bHasPersonalAccessPrivileges)) != 0)
- #define hasUserGroupList(volParms) (((volParms).vMAttrib & (1L << bHasUserGroupList)) != 0)
- #define hasCatSearch(volParms) (((volParms).vMAttrib & (1L << bHasCatSearch)) != 0)
- #define hasFileIDs(volParms) (((volParms).vMAttrib & (1L << bHasFileIDs)) != 0)
- #define hasBTreeMgr(volParms) (((volParms).vMAttrib & (1L << bHasBTreeMgr)) != 0)
- #define hasBlankAccessPrivileges(volParms) \
- (((volParms).vMAttrib & (1L << bHasBlankAccessPrivileges)) != 0)
-
- /*
- ** Deny mode permissions for use with the HOpenAware, HOpenRFAware,
- ** FSpOpenAware, and FSpOpenRFAware functions.
- */
-
- enum
- {
- dmNone = 0x0000,
- dmNoneDenyRd = 0x0010,
- dmNoneDenyWr = 0x0020,
- dmNoneDenyRdWr = 0x0030,
- dmRd = 0x0001, /* Single writer, multiple readers; the readers */
- dmRdDenyRd = 0x0011,
- dmRdDenyWr = 0x0021, /* Browsing - equivalent to fsRdPerm */
- dmRdDenyRdWr = 0x0031,
- dmWr = 0x0002,
- dmWrDenyRd = 0x0012,
- dmWrDenyWr = 0x0022,
- dmWrDenyRdWr = 0x0032,
- dmRdWr = 0x0003, /* Shared access - equivalent to fsRdWrShPerm */
- dmRdWrDenyRd = 0x0013,
- dmRdWrDenyWr = 0x0023, /* Single writer, multiple readers; the writer */
- dmRdWrDenyRdWr = 0x0033 /* Exclusive access - equivalent to fsRdWrPerm */
- };
-
-
- /*
- ** For those times where you need to use more than one kind of File Manager parameter
- ** block but don't feel like wasting stack space, here's a parameter block you can reuse.
- */
- union UniversalFMPB
- {
- ParamBlockRec PB;
- CInfoPBRec ciPB;
- DTPBRec dtPB;
- HParamBlockRec hPB;
- CMovePBRec cmPB;
- WDPBRec wdPB;
- FCBPBRec fcbPB;
- };
- typedef union UniversalFMPB UniversalFMPB;
- typedef UniversalFMPB *UniversalFMPBPtr, **UniversalFMPBHandle;
-
-
- /*
- ** Used by GetUGEntries to return user or group lists
- */
- struct UGEntry
- {
- short objType; /* object type: -1 = group; 0 = user */
- long objID; /* the user or group ID */
- Str31 name; /* the user or group name */
- };
- typedef struct UGEntry UGEntry;
- typedef UGEntry *UGEntryPtr, **UGEntryHandle;
-
-
- typedef unsigned char Str8[9];
-
-
- /*
- ** I use the following record instead of the AFPVolMountInfo structure in Files.h
- */
- struct MyAFPVolMountInfo
- {
- short length; /* length of this record */
- VolumeType media; /* type of media, always AppleShareMediaType */
- short flags; /* 0 = normal mount; set bit 0 to inhibit greeting messages */
- char nbpInterval; /* NBP interval parameter; 7 is a good choice */
- char nbpCount; /* NBP count parameter; 5 is a good choice */
- short uamType; /* User Authentication Method */
- short zoneNameOffset; /* offset from start of record to zoneName */
- short serverNameOffset; /* offset from start of record to serverName */
- short volNameOffset; /* offset from start of record to volName */
- short userNameOffset; /* offset from start of record to userName */
- short userPasswordOffset; /* offset from start of record to userPassword */
- short volPasswordOffset; /* offset from start of record to volPassword */
- Str31 zoneName; /* server's AppleTalk zone name */
- Str31 serverName; /* server name */
- Str27 volName; /* volume name */
- Str31 userName; /* user name (zero length Pascal string for guest) */
- Str8 userPassword; /* user password (zero length Pascal string if no user password) */
- char filler1; /* to word align volPassword */
- Str8 volPassword; /* volume password (zero length Pascal string if no volume password) */
- char filler2; /* to end record on word boundry */
- };
- typedef struct MyAFPVolMountInfo MyAFPVolMountInfo;
- typedef MyAFPVolMountInfo *MyAFPVolMountInfoPtr, **MyAFPVolMountInfoHandle;
-
-
- /*****************************************************************************/
-
- pascal OSErr NameFileSearch(StringPtr volName,
- short vRefNum,
- const Str255 fileName,
- FSSpecPtr matches,
- long reqMatchCount,
- long *actMatchCount,
- Boolean newSearch,
- Boolean partial);
- /* Use NameFileSearch to search for files with a specific file name on a
- volume that supports PBCatSearch.
- Note: A result of catChangedErr means the catalog has changed between
- searches, but the search can be continued with the possiblity that you
- may miss some matches or get duplicate matches. For all other results
- (except for noErr), the search cannot be continued.
-
- volName input: A pointer to the name of a mounted volume
- or nil.
- vRefNum input: Volume specification.
- fileName input: The name of the file to search for.
- matches input: Pointer to array of FSSpec where the match list is
- returned.
- reqMatchCount input: Maximum number of matches to return (the number of
- elements in the matches array).
- actMatchCount output: The number of matches actually returned.
- newSearch input: If true, start a new search. If false and if
- vRefNum is the same as the last call to
- NameFileSearch, then start searching at the
- position where the last search left off.
- partial input: If the partial parameter is false, then only files
- that exactly match fileName will be found. If the
- partial parameter is true, then all file names that
- contain fileName will be found.
- */
-
- /*****************************************************************************/
-
- pascal OSErr CreatorTypeFileSearch(StringPtr volName,
- short vRefNum,
- OSType creator,
- OSType fileType,
- FSSpecPtr matches,
- long reqMatchCount,
- long *actMatchCount,
- Boolean newSearch);
- /* Use CreatorTypeFileSearch to search for files with a specific creator
- or fileType on a volume that supports PBCatSearch.
- Note: A result of catChangedErr means the catalog has changed between
- searches, but the search can be continued with the possiblity that you
- may miss some matches or get duplicate matches. For all other results
- (except for noErr), the search cannot be continued.
-
- volName input: A pointer to the name of a mounted volume
- or nil.
- vRefNum input: Volume specification.
- creator input: The creator type of the file to search for.
- To ignore the creator type, pass 0x00000000 in
- this field.
- fileType input: The file type of the file to search for.
- To ignore the file type, pass 0x00000000 in
- this field.
- matches input: Pointer to array of FSSpec where the match list is
- returned.
- reqMatchCount input: Maximum number of matches to return (the number of
- elements in the matches array).
- actMatchCount output: The number of matches actually returned.
- newSearch input: If true, start a new search. If false and if
- vRefNum is the same as the last call to
- CreatorTypeFileSearch, then start searching at the
- position where the last search left off.
- */
-
- /*****************************************************************************/
-
- pascal OSErr DetermineVRefNum(StringPtr pathname,
- short vRefNum,
- short *realVRefNum);
- /* Use DetermineVRefNum to determine the volume reference number of a
- volume from a pathname, a volume specification, or a combination
- of the two.
- WARNING: Volume names on the Macintosh are *not* unique -- Multiple
- mounted volumes can have the same name. For this reason, the use of a
- volume name or full pathname to identify a specific volume may not
- produce the results you expect. If more than one volume has the same
- name and a volume name or full pathname is used, the File Manager
- currently uses the first volume it finds with a matching name in the
- volume queue.
-
- pathName input: Pointer to a full pathname or nil. If you pass in a
- partial pathname, it is ignored. A full pathname to a
- volume must end with a colon character (:).
- vRefNum input: Volume specification (volume reference number, working
- directory number, drive number, or 0).
- realVRefNum output: The real volume reference number.
- */
-
- /*****************************************************************************/
-
- pascal OSErr UnmountAndEject(StringPtr pathname,
- short vRefNum);
- /* Use UnmountAndEject to unmount and eject a volume. The volume is ejected
- only if it's ejectable and not already ejected.
-
- pathName input: Pointer to a full pathname or nil. If you pass in a
- partial pathname, it is ignored. A full pathname to a
- volume must end with a colon character (:).
- vRefNum input: Volume specification (volume reference number, working
- directory number, drive number, or 0).
- */
-
- /*****************************************************************************/
-
- pascal OSErr OnLine(FSSpecPtr volumes,
- short reqVolCount,
- short *actVolCount,
- short *volIndex);
- /* Use OnLine to return the list of volumes currently mounted.
-
- volumes input: Pointer to array of FSSpec where the volume list
- is returned.
- reqVolCount input: Maximum number of volumes to return (the number of
- elements in the volumes array).
- actVolCount output: The number of volumes actually returned.
- volIndex input: The current volume index position. Set to 1 to
- start with the first volume.
- output: The volume index position to get the next volume.
- Pass this value the next time you call OnLine to
- start where you left off.
- */
-
- /*****************************************************************************/
-
- pascal OSErr GetDirID(short vRefNum,
- long dirID,
- StringPtr name,
- long *theDirID,
- Boolean *isDirectory);
- /* Use GetDirID to get the directory ID number of the directory
- specified. If a file is specified, then the parent
- directory of the file is returned and isDirectory is false. If
- a directory is specified, then that directory's ID number is
- returned and isDirectory is true.
- WARNING: Volume names on the Macintosh are *not* unique -- Multiple
- mounted volumes can have the same name. For this reason, the use of a
- volume name or full pathname to identify a specific volume may not
- produce the results you expect. If more than one volume has the same
- name and a volume name or full pathname is used, the File Manager
- currently uses the first volume it finds with a matching name in the
- volume queue.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID
- specifies a directory that's the object.
- theDirID output: If the object is a file, then its parent directory
- ID. If the object is a directory, then its ID.
- isDirectory output: True if object is a directory; false if
- object is a file.
- */
-
- /*****************************************************************************/
-
- pascal OSErr DirIDFromFSSpec(const FSSpec *spec,
- long *dirID,
- Boolean *isDirectory);
- /* Use DirIDFromFSSpec to get the directory ID number of the directory
- specified by spec. If spec is to a file, then the parent
- directory of the file is returned and isDirectory is false. If
- spec is to a directory, then that directory's ID number is
- returned and isDirectory is true.
-
- spec input: An FSSpec record specifying the directory.
- theDirID output: The directory ID.
- isDirectory output: True if object is a directory; false if
- object is a file.
- */
-
- /*****************************************************************************/
-
- pascal OSErr GetDirName(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use GetDirName to get the name of a directory from its directory ID.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name output: Points to a buffer (minimum Str63) where the
- directory name is to be returned or must be nil.
- */
-
- /*****************************************************************************/
-
- pascal OSErr GetParentID(short vRefNum,
- long dirID,
- StringPtr name,
- long *parID);
- /* Use GetParentID to get the parent directory ID number of the specified
- object.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- parID output: The parent directory ID of the specified object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr GetFilenameFromPathname(const Str255 pathname,
- Str255 filename);
- /* Use GetFilenameFromPathname to get the file (or directory) name from
- the end of a full or partial pathname. Returns notAFileErr if the
- pathname is nil, the pathname is empty, or the pathname cannot refer to
- a filename (with a noErr result, the pathname could still refer to a
- directory). GetFilenameFromPathname is used by GetObjectLocation.
-
- pathname input: A full or partial pathname.
- filename output: The file (or directory) name.
- */
-
- /*****************************************************************************/
-
- pascal OSErr GetObjectLocation(short vRefNum,
- long dirID,
- StringPtr pathname,
- short *realVRefNum,
- long *realParID,
- Str255 realName,
- Boolean *isDirectory);
- /* Use GetObjectLocation to get a file system object's location - that is,
- its real volume reference number, real parent directory ID, and name.
- While we're at it, determine if the object is a file or directory.
- If GetObjectLocation returns fnfErr, then the location information
- returned is valid, but it describes an object that doesn't exist.
- You can use the location information for another operation, such as
- creating a file or directory.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- pathname input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- realVRefNum output: The real volume reference number.
- realParID output: The parent directory ID of the specified object.
- realName output: The name of the specified object (the case of the
- object name may not be the same as the object's
- catalog entry on disk - since the Macintosh file
- system is not case sensitive, it shouldn't matter).
- isDirectory output: True if object is a directory; false if object
- is a file.
- */
-
- /*****************************************************************************/
-
- pascal OSErr GetDirItems(short vRefNum,
- long dirID,
- StringPtr name,
- Boolean getFiles,
- Boolean getDirectories,
- FSSpecPtr items,
- short reqItemCount,
- short *actItemCount,
- short *itemIndex);
- /* Use GetDirItems to return a list of items in a directory.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID
- specifies a directory that's the object.
- getFiles input: Pass true to have files added to the items list.
- getDirectories input: Pass true to have directories added to the
- items list.
- items input: Pointer to array of FSSpec where the item list
- is returned.
- reqItemCount input: Maximum number of items to return (the number
- of elements in the items array).
- actItemCount output: The number of volumes actually returned.
- itemIndex input: The current item index position. Set to 1 to
- start with the first item in the directory.
- output: The item index position to get the next item.
- Pass this value the next time you call
- GetDirItems to start where you left off.
- */
-
- /*****************************************************************************/
-
- pascal OSErr DeleteDirectoryContents(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use DeleteDirectoryContents to delete the contents of a directory.
- All files and subdirectories in the specified directory are deleted.
- If a locked file or directory is encountered, it is unlocked and then
- deleted. If any unexpected errors are encountered,
- DeleteDirectoryContents quits and returns to the caller.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to directory name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr DeleteDirectory(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use DeleteDirectory to delete a directory and its contents.
- All files and subdirectories in the specified directory are deleted.
- If a locked file or directory is encountered, it is unlocked and then
- deleted. After deleting the directories contents, the directory is
- deleted. If any unexpected errors are encountered, DeleteDirectory
- quits and returns to the caller.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to directory name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr BumpDate(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use BumpDate to change the modification date of a file or directory to
- the current date/time. If the modification date is already equal to
- the current date/time, then add one second to the modification date.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpBumpDate(const FSSpec *spec);
- /* Use FSpBumpDate to change the modification date of a file or directory
- to the current date/time. If the modification date is already equal
- to the current date/time, then add one second to the modification date.
-
- spec input: An FSSpec record specifying the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr ChangeCreatorType(short vRefNum,
- long dirID,
- const Str255 name,
- OSType creator,
- OSType fileType);
- /* Use ChangeCreatorType to change the creator or file type of a file.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: The name of the file.
- creator input: The new creator type or 0x00000000 to leave
- the creator type alone.
- fileType input: The new file type or 0x00000000 to leave the
- file type alone.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpChangeCreatorType(const FSSpec *spec,
- OSType creator,
- OSType fileType);
- /* Use FSpChangeCreatorType to change the creator or file type of a file.
-
- spec input: An FSSpec record specifying the file.
- creator input: The new creator type or 0x00000000 to leave
- the creator type alone.
- fileType input: The new file type or 0x00000000 to leave the
- file type alone.
- */
-
- /*****************************************************************************/
-
- pascal OSErr ChangeFDFlags(short vRefNum,
- long dirID,
- StringPtr name,
- Boolean setBits,
- unsigned short flagBits);
- /* Use ChangeFDFlags to set or clear Finder Flag bits in the fdFlags field
- of a file or directory's FInfo record.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- setBits input: If true, then set the bits specified in flagBits.
- If false, then clear the bits specified in flagBits.
- flagBits input: The flagBits parameter specifies which Finder Flag
- bits to set or clear. If a bit in flagBits is set,
- then the same bit in fdFlags is either set or
- cleared depending on the state of the setBits
- parameter.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpChangeFDFlags(const FSSpec *spec,
- Boolean setBits,
- unsigned short flagBits);
- /* Use FSpChangeFDFlags to set or clear Finder Flag bits in the fdFlags
- field of a file or directory's FInfo record.
-
- spec input: An FSSpec record specifying the object.
- setBits input: If true, then set the bits specified in flagBits.
- If false, then clear the bits specified in flagBits.
- flagBits input: The flagBits parameter specifies which Finder Flag
- bits to set or clear. If a bit in flagBits is set,
- then the same bit in fdFlags is either set or
- cleared depending on the state of the setBits
- parameter.
- */
-
- /*****************************************************************************/
-
- pascal OSErr SetIsInvisible(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use SetIsInvisible to set the invisible bit in the fdFlags word of the
- specified file or directory's finder information.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpSetIsInvisible(const FSSpec *spec);
- /* Use FSpSetIsInvisible to set the invisible bit in the fdFlags word of
- the specified file or directory's finder information.
-
- spec input: An FSSpec record specifying the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr ClearIsInvisible(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use ClearIsInvisible to clear the invisible bit in the fdFlags word of
- the specified file or directory's finder information.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpClearIsInvisible(const FSSpec *spec);
- /* Use FSpClearIsInvisible to clear the invisible bit in the fdFlags word
- of the specified file or directory's finder information.
-
- spec input: An FSSpec record specifying the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr SetNameLocked(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use SetNameLocked to set the nameLocked bit in the fdFlags word of the
- specified file or directory's finder information.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpSetNameLocked(const FSSpec *spec);
- /* Use FSpSetNameLocked to set the nameLocked bit in the fdFlags word of
- the specified file or directory's finder information.
-
- spec input: An FSSpec record specifying the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr ClearNameLocked(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use ClearNameLocked to clear the nameLocked bit in the fdFlags word of
- the specified file or directory's finder information.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpClearNameLocked(const FSSpec *spec);
- /* Use FSpClearNameLocked to clear the nameLocked bit in the fdFlags word
- of the specified file or directory's finder information.
-
- spec input: An FSSpec record specifying the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr SetIsStationery(short vRefNum,
- long dirID,
- const Str255 name);
- /* Use SetIsStationery to set the isStationery bit in the fdFlags word
- of the specified file or directory's finder information.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpSetIsStationery(const FSSpec *spec);
- /* Use FSpSetIsStationery to set the isStationery bit in the fdFlags
- word of the specified file or directory's finder information.
-
- spec input: An FSSpec record specifying the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr ClearIsStationery(short vRefNum,
- long dirID,
- const Str255 name);
- /* Use ClearIsStationery to clear the isStationery bit in the fdFlags
- word of the specified file or directory's finder information.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpClearIsStationery(const FSSpec *spec);
- /* Use FSpClearIsStationery to clear the isStationery bit in the fdFlags
- word of the specified file or directory's finder information.
-
- spec input: An FSSpec record specifying the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr SetHasCustomIcon(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use SetHasCustomIcon to set the hasCustomIcon bit in the fdFlags word
- of the specified file or directory's finder information.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpSetHasCustomIcon(const FSSpec *spec);
- /* Use FSpSetHasCustomIcon to set the hasCustomIcon bit in the fdFlags
- word of the specified file or directory's finder information.
-
- spec input: An FSSpec record specifying the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr ClearHasCustomIcon(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use ClearHasCustomIcon to clear the hasCustomIcon bit in the fdFlags
- word of the specified file or directory's finder information.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpClearHasCustomIcon(const FSSpec *spec);
- /* Use FSpClearHasCustomIcon to clear the hasCustomIcon bit in the fdFlags
- word of the specified file or directory's finder information.
-
- spec input: An FSSpec record specifying the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr ClearHasBeenInited(short vRefNum,
- long dirID,
- StringPtr name);
- /* Use ClearHasBeenInited to clear the hasBeenInited bit in the fdFlags
- word of the specified file or directory's finder information.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID specifies
- a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpClearHasBeenInited(const FSSpec *spec);
- /* Use FSpClearHasBeenInited to clear the hasBeenInited bit in the fdFlags
- word of the specified file or directory's finder information.
-
- spec input: An FSSpec record specifying the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr CopyFileMgrAttributes(short srcVRefNum,
- long srcDirID,
- StringPtr srcName,
- short dstVRefNum,
- long dstDirID,
- StringPtr dstName,
- Boolean copyLockBit);
- /* Use CopyFileMgrAttributes to copy all File Manager attributes from the
- source file or directory to the destination file or directory.
- If copyLockBit is true, then set the locked state of the destination
- to match the source.
-
- srcVRefNum input: Source volume specification.
- srcDirID input: Source directory ID.
- srcName input: Pointer to source object name, or nil when
- srcDirID specifies a directory that's the object.
- dstVRefNum input: Destination volume specification.
- dstDirID input: Destination directory ID.
- dstName input: Pointer to destination object name, or nil when
- dstDirID specifies a directory that's the object.
- copyLockBit input: If true, set the locked state of the destination
- to match the source.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpCopyFileMgrAttributes(const FSSpec *srcSpec,
- const FSSpec *dstSpec,
- Boolean copyLockBit);
- /* Use FSpCopyFileMgrAttributes to copy all File Manager attributes from
- the source file or directory to the destination file or directory.
- If copyLockBit is true, then set the locked state of the destination
- to match the source.
-
- srcSpec input: An FSSpec record specifying the source object.
- dstSpec input: An FSSpec record specifying the destination object.
- copyLockBit input: If true, set the locked state of the destination
- to match the source.
- */
-
- /*****************************************************************************/
-
- pascal OSErr HOpenAware(short vRefNum,
- long dirID,
- const Str255 fileName,
- short denyModes,
- short *refNum);
- /* Use HOpenAware to open the data fork of a file using deny mode
- permissions instead the normal File Manager permissions. If OpenDeny
- is not available, then HOpenAware translates the deny modes to the
- closest File Manager permissions and tries to open the file with
- OpenDF first, and then Open if OpenDF isn't available. By using
- HOpenAware with deny mode permissions, a program can be "AppleShare
- aware" and fall back on the standard File Manager open calls
- automatically.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- fileName input: The name of the file.
- denyModes input: The deny modes access under which to open the file.
- refNum output: The file reference number of the opened file.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpOpenAware(const FSSpec *spec,
- short denyModes,
- short *refNum);
- /* Use FSpOpenAware to open the data fork of a file using deny mode
- permissions instead the normal File Manager permissions. If OpenDeny
- is not available, then FSpOpenAware translates the deny modes to the
- closest File Manager permissions and tries to open the file with
- OpenDF first, and then Open if OpenDF isn't available. By using
- FSpOpenAware with deny mode permissions, a program can be "AppleShare
- aware" and fall back on the standard File Manager open calls
- automatically.
-
- spec input: An FSSpec record specifying the file.
- denyModes input: The deny modes access under which to open the file.
- refNum output: The file reference number of the opened file.
- */
-
- /*****************************************************************************/
-
- pascal OSErr HOpenRFAware(short vRefNum,
- long dirID,
- const Str255 fileName,
- short denyModes,
- short *refNum);
- /* Use HOpenRFAware to open the resource fork of a file using deny mode
- permissions instead the normal File Manager permissions. If OpenRFDeny
- is not available, then HOpenRFAware translates the deny modes to the
- closest File Manager permissions and tries to open the file with
- OpenRF. By using HOpenRFAware with deny mode permissions, a program
- can be "AppleShare aware" and fall back on the standard File Manager
- open calls automatically.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- fileName input: The name of the file.
- denyModes input: The deny modes access under which to open the file.
- refNum output: The file reference number of the opened file.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpOpenRFAware(const FSSpec *spec,
- short denyModes,
- short *refNum);
- /* Use FSpOpenRFAware to open the resource fork of a file using deny mode
- permissions instead the normal File Manager permissions. If OpenRFDeny
- is not available, then FSpOpenRFAware translates the deny modes to the
- closest File Manager permissions and tries to open the file with
- OpenRF. By using FSpOpenRFAware with deny mode permissions, a program
- can be "AppleShare aware" and fall back on the standard File Manager
- open calls automatically.
-
- spec input: An FSSpec record specifying the file.
- denyModes input: The deny modes access under which to open the file.
- refNum output: The file reference number of the opened file.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSReadNoCache(short refNum,
- long *count,
- void *buffPtr);
- /* Use FSReadNoCache to read any number of bytes from an open file while
- asking the file system to bypass its cache mechanism.
-
- refNum input: The file reference number of an open file.
- count input: The number of bytes to read.
- output: The number of bytes actually read.
- buffPtr input: A pointer to the data buffer into which the bytes are
- to be read.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSWriteNoCache(short refNum,
- long *count,
- const void *buffPtr);
- /* Use FSReadNoCache to write any number of bytes to an open file while
- asking the file system to bypass its cache mechanism.
-
- refNum input: The file reference number of an open file.
- count input: The number of bytes to write to the file.
- output: The number of bytes actually written.
- buffPtr input: A pointer to the data buffer from which the bytes are
- to be written.
- */
-
-
- /*****************************************************************************/
-
- pascal OSErr CopyFork(short srcRefNum,
- short dstRefNum,
- void *copyBufferPtr,
- long copyBufferSize);
- /* Use CopyFork to copy all data from the source fork to the destination
- fork of open file forks and makes sure the destination EOF is equal
- to the source EOF.
-
- srcRefNum input: The source file reference number.
- dstRefNum input: The destination file reference number.
- copyBufferPtr input: Pointer to buffer to use during copy. The
- buffer should be at least 512-bytes minimum.
- The larger the buffer, the faster the copy.
- copyBufferSize input: The size of the copy buffer.
- */
-
- /*****************************************************************************/
-
- pascal OSErr GetFileLocation(short refNum,
- short *vRefNum,
- long *dirID,
- StringPtr fileName);
- /* Use GetFileLocation to get the location (volume reference number,
- directory ID, and fileName) of an open file.
-
- refNum input: The file reference number of an open file.
- vRefNum output: The volume reference number.
- dirID output: The parent directory ID.
- fileName input: Points to a buffer (minimum Str63) where the
- filename is to be returned or must be nil.
- output: The filename.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpGetFileLocation(short refNum,
- FSSpec *spec);
- /* Use FSpGetFileLocation to get the location of an open file in an
- FSSpec record.
-
- refNum input: The file reference number of an open file.
- spec output: FSSpec record containing the file name and location.
- */
-
- /*****************************************************************************/
-
- pascal OSErr CopyDirectoryAccess(short srcVRefNum,
- long srcDirID,
- StringPtr srcName,
- short dstVRefNum,
- long dstDirID,
- StringPtr dstName);
- /* Use CopyDirectoryAccess to copy the AFP directory access privileges from
- one directory to another. Both directories must be on the same file server,
- but not necessarily on the same server volume.
-
- srcVRefNum input: Source volume specification.
- srcDirID input: Source directory ID.
- srcName input: Pointer to source directory name, or nil when
- srcDirID specifies the directory.
- dstVRefNum input: Destination volume specification.
- dstDirID input: Destination directory ID.
- dstName input: Pointer to destination directory name, or nil when
- dstDirID specifies the directory.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpCopyDirectoryAccess(const FSSpec *srcSpec,
- const FSSpec *dstSpec);
- /* Use FSpCopyDirectoryAccess to copy the AFP directory access privileges from
- one directory to another. Both directories must be on the same file server,
- but not necessarily on the same server volume.
-
- srcSpec input: An FSSpec record specifying the source directory.
- dstSpec input: An FSSpec record specifying the destination directory.
- */
-
- /*****************************************************************************/
-
- pascal OSErr HMoveRenameCompat(short vRefNum,
- long srcDirID,
- const Str255 srcName,
- long dstDirID,
- StringPtr dstpathName,
- StringPtr copyName);
- /* Use HMoveRenameCompat to move a file or directory and optionally to
- rename it. The source and destination locations must be on the same
- volume. This routine works even if the volume doesn't support MoveRename.
-
- vRefNum input: Volume specification.
- srcDirID input: Source directory ID.
- srcName input: The source object name.
- dstDirID input: Destination directory ID.
- dstName input: Pointer to destination directory name, or
- nil when dstDirID specifies a directory.
- copyName input: Points to the new name if the object is to be
- renamed or nil if the object isn't to be renamed.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpMoveRenameCompat(const FSSpec *srcSpec,
- const FSSpec *dstSpec,
- StringPtr copyName);
- /* Use FSpMoveRenameCompat to move a file or directory and optionally to
- rename it. The source and destination locations must be on the same
- volume. This routine works even if the volume doesn't support MoveRename.
-
- srcSpec input: An FSSpec record specifying the source object.
- dstSpec input: An FSSpec record specifying the destination
- directory.
- copyName input: Points to the new name if the object is to be
- renamed or nil if the object isn't to be renamed.
- */
-
- /*****************************************************************************/
-
- pascal void BuildAFPVolMountInfo(short theFlags,
- char theNBPInterval,
- char theNBPCount,
- short theUAMType,
- Str31 theZoneName,
- Str31 theServerName,
- Str27 theVolName,
- Str31 theUserName,
- Str8 theUserPassWord,
- Str8 theVolPassWord,
- MyAFPVolMountInfoPtr theAFPInfo);
- /* Use BuildAFPVolMountInfo to initialize the fields of an AFPVolMountInfo
- record before using that record to call the VolumeMount function.
-
- theFlags input: The AFP mounting flags. 0 = normal mount;
- set bit 0 to inhibit greeting messages.
- theNBPInterval input: The interval used for VolumeMount's
- NBP Lookup call. 7 is a good choice.
- theNBPCount input: The retry count used for VolumeMount's
- NBP Lookup call. 5 is a good choice.
- theUAMType input: The user authentication method to use.
- theZoneName input: The AppleTalk zone name of the server.
- theServerName input: The AFP server name.
- theVolName input: The AFP volume name.
- theUserName input: The user name (zero length Pascal string for
- guest).
- theUserPassWord input: The user password (zero length Pascal string
- if no user password)
- theVolPassWord input: The volume password (zero length Pascal string
- if no volume password)
- theAFPInfo input: Pointer to AFPVolMountInfo record to
- initialize.
- */
-
- /*****************************************************************************/
-
- pascal OSErr RetrieveAFPVolMountInfo(AFPVolMountInfoPtr theAFPInfo,
- short *theFlags,
- short *theUAMType,
- StringPtr theZoneName,
- StringPtr theServerName,
- StringPtr theVolName,
- StringPtr theUserName);
- /* Use RetrieveAFPVolMountInfo to retrieve the AFP mounting information
- returned in an AFPVolMountInfo by the GetVolMountInfo function.
-
- theAFPInfo input: Pointer to AFPVolMountInfo record that contains
- the AFP mounting information.
- theFlags output: The AFP mounting flags. 0 = normal mount;
- if bit 0 is set, greeting meesages were inhibited.
- theUAMType output: The user authentication method used.
- theZoneName output: The AppleTalk zone name of the server.
- theServerName output: The AFP server name.
- theVolName output: The AFP volume name.
- theUserName output: The user name (zero length Pascal string for
- guest).
- */
-
- /*****************************************************************************/
-
- pascal OSErr GetUGEntries(short objType,
- UGEntryPtr entries,
- long reqEntryCount,
- long *actEntryCount,
- long *objID);
- /* Use GetUGEntries to build a list of user or group entries from the
- local file server.
-
- objType input: The object type: -1 = group; 0 = user
- UGEntries input: Pointer to array of UGEntry records where the list
- is returned.
- reqEntryCount input: The number of elements in the UGEntries array.
- actEntryCount output: The number of entries returned.
- objID input: The current index position. Set to 0 to start with
- the first entry.
- output: The index position to get the next entry. Pass this
- value the next time you call GetUGEntries to start
- where you left off.
- */
-
- /*****************************************************************************/
-
- pascal OSErr CopyComment(short srcVRefNum,
- long srcDirID,
- StringPtr srcName,
- short dstVRefNum,
- long dstDirID,
- StringPtr dstName);
- /* Use CopyComment to copy the desktop database comment from the source
- to the destination object. Both source and the destination volumes
- must support the Desktop Manager.
-
- srcVRefNum input: Source volume specification.
- srcDirID input: Source directory ID.
- srcName input: Pointer to source object name, or nil when srcDirID
- specifies a directory that's the object.
- dstVRefNum input: Destination volume specification.
- dstDirID input: Destination directory ID.
- dstName input: Pointer to destination object name, or nil when
- dstDirID specifies a directory that's the object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpCopyComment(const FSSpec *srcSpec,
- const FSSpec *dstSpec);
- /* Use FSpCopyComment to copy the desktop database comment from the source
- to the destination object. Both the source and the destination volumes
- must support the Desktop Manager.
-
- srcSpec input: An FSSpec record specifying the source object.
- dstSpec input: An FSSpec record specifying the destination object.
- */
-
- /*****************************************************************************/
-
- pascal OSErr SetComment(short vRefNum,
- long dirID,
- StringPtr name,
- const Str255 comment);
- /* Use SetComment to set a file or directory's Finder comment field.
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID
- specifies a directory that's the object.
- comment input: The comment to add. Comments are limited to 200 characters;
- longer comments are clipped.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpSetComment(const FSSpec *spec,
- const Str255 comment);
- /* Use FSpSetComment to set a file or directory's Finder comment field.
-
- spec input: An FSSpec record specifying the file or directory.
- comment input: The comment to add. Comments are limited to 200 characters;
- longer comments are clipped.
- */
-
- /*****************************************************************************/
-
- pascal OSErr GetComment(short vRefNum,
- long dirID,
- StringPtr name,
- StringPtr comment);
- /* Use GetComment to get a file or directory's Finder comment field (if any).
-
- vRefNum input: Volume specification.
- dirID input: Directory ID.
- name input: Pointer to object name, or nil when dirID
- specifies a directory that's the object.
- comment output: Points to a buffer (minimum STRING[200]) where the
- comment is to be returned.
- */
-
- /*****************************************************************************/
-
- pascal OSErr FSpGetComment(const FSSpec *spec,
- StringPtr comment);
- /* Use GetComment to get a file or directory's Finder comment field (if any).
-
- spec input: An FSSpec record specifying the file or directory.
- comment output: Points to a buffer (minimum STRING[200]) where the
- comment is to be returned.
- */
-
- #endif
-